﻿using System;
using Mono.Collections.Generic;

namespace Mono.Cecil
{
	// Token: 0x020000B6 RID: 182
	public sealed class ParameterDefinition : ParameterReference, ICustomAttributeProvider, IMetadataTokenProvider, IConstantProvider, IMarshalInfoProvider
	{
		// Token: 0x170001E9 RID: 489
		// (get) Token: 0x0600076B RID: 1899 RVA: 0x000232F4 File Offset: 0x000214F4
		// (set) Token: 0x0600076C RID: 1900 RVA: 0x000049BD File Offset: 0x00002BBD
		public ParameterAttributes Attributes
		{
			get
			{
				return (ParameterAttributes)this.attributes;
			}
			set
			{
				this.attributes = (ushort)value;
			}
		}

		// Token: 0x170001EA RID: 490
		// (get) Token: 0x0600076D RID: 1901 RVA: 0x0002330C File Offset: 0x0002150C
		public IMethodSignature Method
		{
			get
			{
				return this.method;
			}
		}

		// Token: 0x170001EB RID: 491
		// (get) Token: 0x0600076E RID: 1902 RVA: 0x00023324 File Offset: 0x00021524
		public int Sequence
		{
			get
			{
				bool flag = this.method == null;
				int result;
				if (flag)
				{
					result = -1;
				}
				else
				{
					result = (this.method.HasImplicitThis() ? (this.index + 1) : this.index);
				}
				return result;
			}
		}

		// Token: 0x170001EC RID: 492
		// (get) Token: 0x0600076F RID: 1903 RVA: 0x00023364 File Offset: 0x00021564
		// (set) Token: 0x06000770 RID: 1904 RVA: 0x000233A0 File Offset: 0x000215A0
		public bool HasConstant
		{
			get
			{
				this.ResolveConstant(ref this.constant, this.parameter_type.Module);
				return this.constant != Mixin.NoValue;
			}
			set
			{
				bool flag = !value;
				if (flag)
				{
					this.constant = Mixin.NoValue;
				}
			}
		}

		// Token: 0x170001ED RID: 493
		// (get) Token: 0x06000771 RID: 1905 RVA: 0x000233C4 File Offset: 0x000215C4
		// (set) Token: 0x06000772 RID: 1906 RVA: 0x000049C7 File Offset: 0x00002BC7
		public object Constant
		{
			get
			{
				return this.HasConstant ? this.constant : null;
			}
			set
			{
				this.constant = value;
			}
		}

		// Token: 0x170001EE RID: 494
		// (get) Token: 0x06000773 RID: 1907 RVA: 0x000233E8 File Offset: 0x000215E8
		public bool HasCustomAttributes
		{
			get
			{
				bool flag = this.custom_attributes != null;
				bool result;
				if (flag)
				{
					result = (this.custom_attributes.Count > 0);
				}
				else
				{
					result = this.GetHasCustomAttributes(this.parameter_type.Module);
				}
				return result;
			}
		}

		// Token: 0x170001EF RID: 495
		// (get) Token: 0x06000774 RID: 1908 RVA: 0x0002342C File Offset: 0x0002162C
		public Collection<CustomAttribute> CustomAttributes
		{
			get
			{
				return this.custom_attributes ?? this.GetCustomAttributes(ref this.custom_attributes, this.parameter_type.Module);
			}
		}

		// Token: 0x170001F0 RID: 496
		// (get) Token: 0x06000775 RID: 1909 RVA: 0x00023460 File Offset: 0x00021660
		public bool HasMarshalInfo
		{
			get
			{
				bool flag = this.marshal_info != null;
				return flag || this.GetHasMarshalInfo(this.parameter_type.Module);
			}
		}

		// Token: 0x170001F1 RID: 497
		// (get) Token: 0x06000776 RID: 1910 RVA: 0x00023494 File Offset: 0x00021694
		// (set) Token: 0x06000777 RID: 1911 RVA: 0x000049D1 File Offset: 0x00002BD1
		public MarshalInfo MarshalInfo
		{
			get
			{
				return this.marshal_info ?? this.GetMarshalInfo(ref this.marshal_info, this.parameter_type.Module);
			}
			set
			{
				this.marshal_info = value;
			}
		}

		// Token: 0x170001F2 RID: 498
		// (get) Token: 0x06000778 RID: 1912 RVA: 0x000234C8 File Offset: 0x000216C8
		// (set) Token: 0x06000779 RID: 1913 RVA: 0x000049DB File Offset: 0x00002BDB
		public bool IsIn
		{
			get
			{
				return this.attributes.GetAttributes(1);
			}
			set
			{
				this.attributes = this.attributes.SetAttributes(1, value);
			}
		}

		// Token: 0x170001F3 RID: 499
		// (get) Token: 0x0600077A RID: 1914 RVA: 0x000234E8 File Offset: 0x000216E8
		// (set) Token: 0x0600077B RID: 1915 RVA: 0x000049F1 File Offset: 0x00002BF1
		public bool IsOut
		{
			get
			{
				return this.attributes.GetAttributes(2);
			}
			set
			{
				this.attributes = this.attributes.SetAttributes(2, value);
			}
		}

		// Token: 0x170001F4 RID: 500
		// (get) Token: 0x0600077C RID: 1916 RVA: 0x00023508 File Offset: 0x00021708
		// (set) Token: 0x0600077D RID: 1917 RVA: 0x00004A07 File Offset: 0x00002C07
		public bool IsLcid
		{
			get
			{
				return this.attributes.GetAttributes(4);
			}
			set
			{
				this.attributes = this.attributes.SetAttributes(4, value);
			}
		}

		// Token: 0x170001F5 RID: 501
		// (get) Token: 0x0600077E RID: 1918 RVA: 0x00023528 File Offset: 0x00021728
		// (set) Token: 0x0600077F RID: 1919 RVA: 0x00004A1D File Offset: 0x00002C1D
		public bool IsReturnValue
		{
			get
			{
				return this.attributes.GetAttributes(8);
			}
			set
			{
				this.attributes = this.attributes.SetAttributes(8, value);
			}
		}

		// Token: 0x170001F6 RID: 502
		// (get) Token: 0x06000780 RID: 1920 RVA: 0x00023548 File Offset: 0x00021748
		// (set) Token: 0x06000781 RID: 1921 RVA: 0x00004A33 File Offset: 0x00002C33
		public bool IsOptional
		{
			get
			{
				return this.attributes.GetAttributes(16);
			}
			set
			{
				this.attributes = this.attributes.SetAttributes(16, value);
			}
		}

		// Token: 0x170001F7 RID: 503
		// (get) Token: 0x06000782 RID: 1922 RVA: 0x00023568 File Offset: 0x00021768
		// (set) Token: 0x06000783 RID: 1923 RVA: 0x00004A4A File Offset: 0x00002C4A
		public bool HasDefault
		{
			get
			{
				return this.attributes.GetAttributes(4096);
			}
			set
			{
				this.attributes = this.attributes.SetAttributes(4096, value);
			}
		}

		// Token: 0x170001F8 RID: 504
		// (get) Token: 0x06000784 RID: 1924 RVA: 0x0002358C File Offset: 0x0002178C
		// (set) Token: 0x06000785 RID: 1925 RVA: 0x00004A64 File Offset: 0x00002C64
		public bool HasFieldMarshal
		{
			get
			{
				return this.attributes.GetAttributes(8192);
			}
			set
			{
				this.attributes = this.attributes.SetAttributes(8192, value);
			}
		}

		// Token: 0x06000786 RID: 1926 RVA: 0x00004A7E File Offset: 0x00002C7E
		internal ParameterDefinition(TypeReference parameterType, IMethodSignature method) : this(string.Empty, ParameterAttributes.None, parameterType)
		{
			this.method = method;
		}

		// Token: 0x06000787 RID: 1927 RVA: 0x00004A96 File Offset: 0x00002C96
		public ParameterDefinition(TypeReference parameterType) : this(string.Empty, ParameterAttributes.None, parameterType)
		{
		}

		// Token: 0x06000788 RID: 1928 RVA: 0x00004AA7 File Offset: 0x00002CA7
		public ParameterDefinition(string name, ParameterAttributes attributes, TypeReference parameterType) : base(name, parameterType)
		{
			this.attributes = (ushort)attributes;
			this.token = new MetadataToken(TokenType.Param);
		}

		// Token: 0x06000789 RID: 1929 RVA: 0x000235B0 File Offset: 0x000217B0
		public override ParameterDefinition Resolve()
		{
			return this;
		}

		// Token: 0x04000286 RID: 646
		private ushort attributes;

		// Token: 0x04000287 RID: 647
		internal IMethodSignature method;

		// Token: 0x04000288 RID: 648
		private object constant = Mixin.NotResolved;

		// Token: 0x04000289 RID: 649
		private Collection<CustomAttribute> custom_attributes;

		// Token: 0x0400028A RID: 650
		private MarshalInfo marshal_info;
	}
}
